package com.zlc.common.core.process.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zlc.common.common.service.BaseServiceImpl;
import com.zlc.common.core.process.model.entity.StoneInterfaceClass;
import com.zlc.common.core.process.model.entity.StoneInterfaceConfig;
import com.zlc.common.core.process.mapper.StoneInterfaceConfigMapper;
import com.zlc.common.core.process.model.vo.StoneInterfaceConfigVo;
import com.zlc.common.core.process.service.StoneInterfaceConfigService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author  zl
 * @date 2023-10-17 
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class StoneInterfaceConfigServiceImpl extends BaseServiceImpl<StoneInterfaceConfigMapper, StoneInterfaceConfig, StoneInterfaceConfigVo> implements StoneInterfaceConfigService{

    @Override
    public List<StoneInterfaceConfigVo> getByClassId(String classId) {
        LambdaQueryWrapper<StoneInterfaceConfig> wrapper = wrapper()
                .eq(StoneInterfaceConfig::getClassId, classId)
                .orderByAsc(StoneInterfaceConfig::getOrder);
        return queryVoList(wrapper);
    }

    @Override
    public StoneInterfaceConfigVo getByInterId(String interId) {
        LambdaQueryWrapper<StoneInterfaceConfig> wrapper = wrapper()
                .eq(StoneInterfaceConfig::getInterId, interId);
        return queryOne(wrapper);
    }
}
